package genhandle

import (
	"fginTpl/gin_gen/config"
	"fginTpl/gin_gen/globals"
	"fginTpl/utils"
	"path/filepath"
)

// 生成路由
func GenRouters() {
	tplParams := map[string]string{
		"ProjectName": config.ConfigData.ProjectName,
	}
	// 	总路由入口
	if err := utils.TourchFile(filepath.Join(globals.BASEDIR, "./routers/init_router.go"), "./gin_templates/routers/init_router.tpl", "initRouterGoTpl", nil); err != nil {
		panic(err)
	}
	// example 例子
	if err := utils.TourchFile(filepath.Join(globals.BASEDIR, "./routers/example_router.go"), "./gin_templates/routers/example_router.tpl", "exampleRouterGoTpl", tplParams); err != nil {
		panic(err)
	}
}
